home *** CD-ROM | disk | FTP | other *** search
- Path: fims-ara1.massey.ac.nz!user
- From: N.Perry@massey.ac.nz (Nigel Perry)
- Newsgroups: comp.lang.ada,comp.lang.c++
- Subject: Re: on OO differnces between Ada95 and C++
- Date: Tue, 27 Feb 1996 20:52:33 +1200
- Organization: Dept of Computer Science, Massey University
- Message-ID: <N.Perry-2702962052330001@fims-ara1.massey.ac.nz>
- References: <4gbq7q$g08@qualcomm.com> <3129F185.41C6@Rational.COM> <4gi413$qo1@druid.borland.com> <4gspen$ot0@hacgate2.hac.com> <4gt3ag$76m@druid.borland.com>
- NNTP-Posting-Host: fims-ara1.massey.ac.nz
-
- In article <4gt3ag$76m@druid.borland.com>, pete@borland.com (Pete Becker) wrote:
-
- <snip>
- >No, my original statement is correct: a program which contains multiple
- >definitions of the same class is not a valid C++ program because it violates
- >the one definition rule. That is exactly the case that the original message
- <snip>
- >so cavalierly. There aren't many compilers that enforce this rule, but it is
- >nevertheless a constraint on valid C++ programs.
-
- C++ Draft Standard: 3.2 One defintion rule, clause 8:
-
- No diagnostic is required for a violation of the ODR rule.
-
- Similarly, 3.5 Program and linkage, clause 9 ends:
-
- A violation of this rule on type identity does not require a diagnostic
-
- [also many other places in the Standard]
-
- What does this mean. Well Pete may be right (I haven't checked) that the
- code is "wrong", but "wrong" code does not require a diagnostic in C++.
- The opposite of a diagnostic is surely a succesful compile & link (but not
- necessarily a succesful execution!), so "wrong" code meets the Standard...
- My guess is that defining "private" as "public" to break encapsulation
- isn't forbidden by the Standard - if it was then it wouldn't be C/C++
- would it? :-)
-
- Don't people use C/C++ so they *can* break the rules? If you want strict type
- checking etc. go use Ada 95, Haskell, SML, etc. etc. etc.
-
- Just my 2c's worth :-)
-
- --
- Dr Nigel Perry Email: N.Perry@massey.ac.nz
- Department of Computer Science Tel: +64 6 350 4007
- Massey University Fax: +64 6 350 5611 Attn. Dr N. Perry
- Palmerston North Ftp/Gopher: smis-asterix.massey.ac.nz
- New Zealand (Mac software/Research papers)
-
- The Cycle Helmet Law: New Zealand's Shame, Speeding before children :-(
- Prevention is better than padding!
-